Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[T2135] FIX: Security issue in project - Check domain of presentation video link. #62

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

auclerc
Copy link
Contributor

@auclerc auclerc commented Jan 31, 2025

No description provided.

@auclerc auclerc self-assigned this Jan 31, 2025
Copy link
Member

@ecino ecino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also consider my suggestions made in the other PR about the FB,Insta links.

crowdfunding_compassion/models/crowdfunding_project.py Outdated Show resolved Hide resolved
parsed_url = urlparse(self.presentation_video)
domain = parsed_url.netloc.lower()

if not (domain == "youtube.com" or domain.endswith(".youtube.com")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the second test including the first condition. Wouldn't this give the same result (and simplify the code)?

Suggested change
if not (domain == "youtube.com" or domain.endswith(".youtube.com")
if not (domain.endswith("youtube.com")

domain = parsed_url.netloc.lower()

if not (domain == "youtube.com" or domain.endswith(".youtube.com")
or domain == "vimeo.com" or domain.endswith(".vimeo.com")):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
or domain == "vimeo.com" or domain.endswith(".vimeo.com")):
or domain.endswith("vimeo.com")):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, because it would mean that www.avimeo.com/video1 would pass, which is exactly what we want to avoid.

@ecino ecino merged commit 9e7bd82 into 14.0 Feb 11, 2025
3 checks passed
@ecino ecino deleted the T2135 branch February 11, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants